<% layout('/layout/default.html', {title: '文件夹管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-sitemap"></i> 文件夹管理
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
				<a href="#" class="btn btn-default"  id="btnRefreshTree" title="刷新"><i class="fa fa-refresh"></i> 刷新</a>
				<a href="#" class="btn btn-default" id="btnExpandTreeNode" title="展开一级"><i class="fa fa-angle-double-down"></i> 展开</a>
				<a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="折叠全部"><i class="fa fa-angle-double-up"></i> 折叠</a>
				<% if(hasPermi('filetree:sysFileTree:edit')){ %>
					<a href="/filetree/sysFileTree/form" class="btn btn-default btnTool" title="添加根文件夹"><i class="fa fa-plus"></i> 添加根文件夹</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<form id="searchForm" action="${ctx}/filetree/sysFileTree/listData" class="form-inline hide">
				<div class="form-group">
					<label class="control-label">名称：</label>
					<div class="control-inline">
						<input name="name" maxlength="64" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">查询</button>
					<button type="reset" class="btn btn-default btn-sm">重置</button>
				</div>
			</form>			
			<table id="dataGrid"></table>
		</div>
	</div>
</div>
<% } %>
<script>
//初始化DataGrid对象
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		columnModel: [
			{header:'名称', name:'name', index:'a.name', width:150, align:"left"},
			{header:'更新时间', name:'updateDate', index:'a.update_date', width:80, align:"center",formatter:"date"},
			{header:'备注', name:'remarks', index:'a.remarks', width:80, align:"center"},
			{header:'操作', name:'actions', width:70,align:"center", sortable:false, title:false, formatter: function(val, obj, row, act){
				var actions = [];
				<% if(hasPermi('filetree:sysFileTree:edit')){ %>
					actions.push('<a href="/filetree/sysFileTree/form?id='+row.id+'" class="btnList" title="修改"><i class="fa fa-pencil"></i></a>');
					actions.push('<a href="${ctx}/filetree/sysFileTree/delete?id='+row.id+'" class="btnList" title="删除" data-confirm="确认要删除该文件夹吗?"><i class="fa fa-trash-o"></i></a>');
					actions.push('<a href="/filetree/sysFileTree/add?parentId='+row.id+'&parentName='+row.name+'" class="btnList" title="新增文件夹"><i class="fa fa-plus-square"></i></a>&nbsp;');
					actions.push('<a href="/filetree/sysFileTree/move?id='+row.id+'" class="btnList" title="移动文件夹"><i class="glyphicon glyphicon-share-alt"></i></a>&nbsp;');
				<% } %>
				return actions.join('');
			}}
		],
		treeGrid: true,
		defaultExpandLevel: 0,
		expandNodeClearPostData: 'name', 
		// 加载成功后执行事件
		ajaxSuccess: function(data){
			
		}
	});
</script>
